<%--
*
* 描述：附件管理表BASIC_DOCUMENTS_UPLOAD的list文件列表
* 
* @author tch 
*
--%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="g" uri="/fishergrid-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title><s:property value="operate"/>附件管理列表</title>
	<%@include file="/share/header.jsp"%>
	<s:head/>	
	<g:header theme="${sessionScope.skinCon.gridSkin}"/>	
  </head>
  <body>
	<script type="text/javascript">
		//新增
		function onDoAdd(name,g){
			top.uploadListWindow=window;	
			
			var url = '<s:url action="new" namespace='/basic/documentsupload'/>?actionName=<%=request.getParameter("actionName") %>';
			var parentId = '<%=request.getParameter("parentId") %>';
			var fileExtensionStr = '<%=request.getParameter("fileExtensionStr") %>';//文件后缀类型
			var businessType = '<%=request.getParameter("businessType") %>';//文件业务类型
			var fileSize = '<%=request.getParameter("fileSize") %>';//文件大小
			var businessTypeInitValue = '<%=request.getParameter("businessTypeInitValue") %>';//默认下拉框显示选项
			if(parentId!=-1)
			{
				 top.AsyncBox_Upload_Adapter('open_window_uploadfile','上传附件',url,'&fileSize='+fileSize+'&parentId='+parentId+'&fileExtensionStr='+fileExtensionStr+'&businessType='+businessType+'&businessTypeInitValue='+businessTypeInitValue,390,frames[0],480);
			 }
			 else
			 {
			 	asyncbox.tips('请先保存主表单信息再添加相应附件！','alert',3000);
			 }
		}
	
		//下载	
		function onDoOperateRenderer(tdDiv,pid){
			var options={
				title:'【下载附件】',
				url:'<s:url action="edit" namespace='/basic/documentsupload'/>?domain.id='+pid,
				source : window,
				buttons:[top.MyWindow.Save,top.MyWindow.Cancel],
				multiplewidth:1,
				multipleheight:1,
				tipstitle:'',
				tipscontent:''
			};
			var edithtml='<a href="javascript:void(0);" title="下载">下载</a>';
			$(tdDiv).html("");//去除原有的内容
			$(tdDiv).append($(edithtml).click(function(){//添加链接
											window.location.href='<s:url action="edit" namespace='/basic/documentsupload'/>?domain.id='+pid;
										})
							);
		}	
		//查看		
		function onDoNameRenderer(tdDiv,pid){
			var options={
				title:'【查看附件管理】',
				url:'<s:url action="view" namespace='/basic/documentsupload'/>?readonly=true&domain.id='+pid,
				source : window,
				buttons:[top.MyWindow.Close],
				multiplewidth:1,
				multipleheight:1,
				tipstitle:'',
				tipscontent:''
			};			
			var viewhtml='<a href="javascript:void(0);" title="查看【'+$(tdDiv).html()+'】详细信息">'+$(tdDiv).html()+'</a>';
			$(tdDiv).html("");//去除原有的内容
			$(tdDiv).append($(viewhtml).click(function(){//添加链接
											top.MyWindow.open(options);
										})
							);				
		}		
		//删除
		function onDoDelete(name,grid){
			onDoAjax({url:'<s:url action='deletes' namespace='/basic/documentsupload'></s:url>'});
		}	
		//启用
		function onDoEnable(name,grid){
			onDoAjax({url:'<s:url action='changes' namespace='/basic/documentsupload'></s:url>?domain.state=1',tip:'启用'});
		}
		//停用
		function onDoUnEnable(name,grid){
			onDoAjax({url:'<s:url action='changes' namespace='/basic/documentsupload'></s:url>?domain.state=2',tip:'停用'});
		}
		//复制
		function onDoCopy(name,grid){
			onDoAjax({url:'<s:url action='copys' namespace='/basic/documentsupload'></s:url>',tip:'复制'});
		}
		//批量保存
		function onDoSaves(){
			fisherSaves({url:'<s:url action='saves' namespace='/basic/documentsupload'></s:url>'});
		}
		//批量保存
		function onDoBatchSave()
		{
			var flag = batchFisherSave({url:'<s:url action='saves' namespace='/basic/documentsupload'></s:url>'});
			top.unloading();
			return flag;
		}	
	</script>  
  	<s:actionerror/>
  	<g:grid name="/basic/documentsupload/documents_upload.fisher.xml"  queryColumn="filterId&&filterActionName" queryValue="parentId&&actionName" rp="15" queryBreak="2">
  		<g:select/>
  		<g:separator/>
  		<s:if test="%{#attr.readonly==false}">
  		<s:if test="isUploadOperation=='true'">
  		<g:button name="上传" styleClass="fisherAdd" onclick="onDoAdd"/>
  		<g:separator/>  
	  	<g:button name="保存" styleClass="fisherSave" onclick="onDoSaves"/>   
  		<g:separator/> 
  		<g:button name="删除" styleClass="fisherDelete" onclick="onDoDelete"/>
  		<g:separator/>   
  		</s:if>		
  		</s:if>		
  		<g:query/>
  	</g:grid>
  </body>
</html>
